<?php

static $gcw = NULL;

function words_cb($ar)
{
	foreach ($ar as $tmp)
	{
		if ($tmp == "\n")
		{
			continue;
		}
	}
	flush();
}



function keyword_pscw($inputArr)
{
	$dict = './../wc/dict/dict.xdb';	
	$mydata  = NULL;	
	$version = 3;		
	$autodis = true;	
	$ignore  = true;	
	$debug   = false;	
	$stats	 = true;	



	$object = 'PSCWS' . $version;
	require_once ('./../wc/' . strtolower($object) . '.class.php');
	$gcw = new $object($dict);
	$gcw->set_ignore_mark($ignore);

	$gcw->set_autodis($autodis);
	$gcw->set_debug($debug);
	$gcw->set_statistics($stats);
	
	$mydata = stripslashes($inputArr);

	if (!is_null($mydata)) 
		$mydata = trim($mydata);
	$gcw->segment($mydata, 'words_cb');
	$list = &$gcw->get_statistics();
	$newerr = array();
	$i = 0;

	foreach ($list as $k => $v)
	{
		$newerr[$i][1] = $k;
		
		$newerr[$i][2] = $v['times'];
		
		$i++;
	}
	return $newerr;
}

?>

